package cn.xorange.commons.security.filter;

import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.PostConstruct;
import java.util.*;

/**
 * @author : yangjian
 * @date : 2023/12/23
 */
public class FilterHandlerFactory {

    private static final Map<String, FilterHandler> filterInternalMap = new HashMap<>();

    @Autowired
    List<FilterHandler> filterInternalHandlerList = Collections.emptyList();

    @PostConstruct
    public void init(){
        for(FilterHandler filterInternalHandler: filterInternalHandlerList){
            filterInternalMap.put(filterInternalHandler.url(),filterInternalHandler);
        }
    }

    public FilterHandler getFilterHandler(String url){
        return   filterInternalMap.get(url);
    }
}
